home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
utilities
/
pu309.dms
/
pu309.adf
/
Satellite
/
tracker10
< prev
next >
Wrap
Text File
|
1990-09-29
|
11KB
|
382 lines
' "TRACKER10" Satellite tracking program with graphics
' ---------
'
'Version 1.02 : Last mod 2nd March 1990 by ACH
'
'(C) 1988 Mr J R Miller G3RUH
'(C) 1988 Mr A C Hewat G8NTH
'
'V 1.00: First version ; original concept with limited graphics etc.
'V 1.01: Change of order of initilisation for constants to fix date.
'V 1.02: Minor changes to make itteration more accurate. Format change.
DEFDBL a-z
CLEAR,55000&,6000&
DIM C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13(10),SatName$(10),stepSize(10),ObjectShape$(10)
DIM days&(12)
Main:
predictionTime = 0
lastChoise = 1
menuItem = 1
oldSatellite = 1
oldChoise1 = 1
GOSUB Ephemeris
GOSUB Constants
GOSUB TodayDate
OPEN "scrn:" FOR OUTPUT AS #2
LOCATE 2,1: PRINT "Tracker 10 - V1.02 (C) 1989 A C Hewat G8NTH @ GB3UP-2 "
LOCATE 5,1
PRINT "Satellite Orbit Lat Long Height MA EL AZ Range Rate Mode Illm Sqnt";
Quit = -1
realTimeFlag = -1
WHILE Quit
LOCATE 6,1
FOR satellite = 1 TO 10
GOSUB DisplayTimePos
GOSUB SatelliteConstants
GOSUB CalcthenDisplay
GOSUB DisplaySatInfo
NEXT
WEND
MENU OFF: MOUSE OFF: TIMER OFF
MENU RESET
CLS
END
DisplayTimePos:
csrY = CSRLIN: csrX = POS(0)
LOCATE 2,65
PRINT TIME$;" UTC";
LOCATE csrY,csrX
RETURN
CalcthenDisplay:
GOSUB TimeNow
TN = DY + (hour+minutes/60)/24
GOSUB SatVec
GOSUB RangeVec
GOSUB SunVec
RETURN
DisplaySatInfo:
satLat1 = CINT(satLat1): satLong1 = CINT(satLong1): ssrr = FNRN(ssrr-RE): SQ = FNRN(SQ)
EL = CINT(EL): AZ = CINT(AZ): R = FNRN(R): m = INT(m*128/pi): ILL = FNRN(100*ILL)
IF satellite = 1 THEN
mode$ = "B"
ELSEIF satellite = 3 THEN
IF m > 0 AND m < 110 THEN mode$ = "B"
IF m > 109 AND m < 145 THEN mode$ = "JL"
IF m > 144 AND m < 150 THEN mode$ = "B Bcn"
IF m > 144 AND m < 147 THEN mode$ = "S Bcn"
IF m > 146 AND m < 160 THEN mode$ = "S"
IF m > 149 AND m < 255 THEN mode$ = "B"
IF m < 35 OR m > 225 THEN mode$ = "B Omi"
ELSE
mode$ = " "
END IF
PRINT SatName$(satellite);TAB(12);
PRINT USING "#####";RN;
PRINT TAB(18);satLat1;TAB(23);satLong1;TAB(28);
PRINT USING "#####";ssrr;
PRINT TAB(35) USING "###";m;
PRINT " ";
IF EL > -3 THEN
PRINT TAB(39);EL;TAB(43);AZ;TAB(49);
PRINT USING "#####";R;
' PRINT TAB(55);RR;
PRINT TAB(62);mode$;TAB(69);ILL;TAB(74);SQ
ELSE
PRINT TAB(41)" "
END IF
RETURN
CheckMenu:
menuId = MENU(0)
menuItem = MENU(1)
ON menuId GOTO Project,SatelliteChoise,Predictions,Display
RETURN
Project:
MENU 1,lastChoise,1
IF menuItem = 3 AND echo = 1 THEN Jump
MENU 1,menuItem,2
Jump:
IF menuItem = 3 THEN GOSUB EchoSet
IF menuItem = 4 THEN Quit = 0
lastChoise = menuItem
RETURN
SatelliteChoise:
MENU 2,oldSatellite,1
whichSatellite = menuItem
MENU 2,whichSatellite,2
oldSatellite = whichSatellite
RETURN
SatelliteConstants:
YE = C1(satellite) 'Epoch year
TE = C2(satellite) 'Epoch time
IN = C3(satellite) 'Inclination
RA = C4(satellite) 'R.A.A.N.
EC = C5(satellite) 'Eccentricity
WP = C6(satellite) 'Arg of perigee
MA = C7(satellite) 'Mean anomaly
MM = C8(satellite) 'Mean motion
M2 = C9(satellite) 'Decay rate
RV = C10(satellite) 'Epoch rev
a = C11(satellite) 'Semi-major axis. 0 if not known
ALAT = C12(satellite) 'Sat att, deg. 0 = in plain, + = below
ALON = C13(satellite) 'Sat att, deg CCW from SMA dir. 180 = Normal
IF a = 0 THEN a = (8681668.016000001#/MM)^(2/3)
RA = RAD*RA
MA = RAD*MA
IN = RAD*IN
MM = MM*2*pi
WP = RAD*WP
M2 = M2*2*pi
ALAT = RAD*ALAT
ALON = RAD*ALON
B = a*SQR(1-EC*EC)
SI = SIN(IN): CI = COS(IN)
PC = RE*a/(B*B): PC = 1.5*J2*PC*PC*MM
QD = -PC*CI
WD = PC*(5*CI*CI-1)/2
DC = (M2/MM)/3
TEG = FNDO(YE)-FNDO(YG) + TE
GHAE = RAD*GO + TEG*WE
MRSE = RAD*GO + TEG*WW + pi
MASE = RAD*(MASO + MASD*TEG)
RETURN
SatVec:
T = (FNDO(YR)-FNDO(YE)) + (TN-TE)
DT = DC*T/2
KD = 1-4*DT
KDP = 1+7*DT
m = MA + MM*T*(1+3*DT)
DR = INT(m/(2*pi))
m = m - DR*2*pi
RN = RV + DR
EA = m
Loop:
C = COS(EA)
S = SIN(EA)
DNOM = 1-EC*C
DE = (EA - EC*S - m)/DNOM
EA = EA - DE
IF ABS(DE) > .002 THEN GOTO Loop
C = COS(EA)
S = SIN(EA)
RGC = a*(1-EC*C)*KD
SX = a*(C-EC)*KD: TA = -COS(ALAT): XA = TA*COS(ALON)
SY = B*S*KD: YA = TA*SIN(ALON): ZA = -SIN(ALAT)
W = WP + WD*T*KDP: C = COS(W): S = SIN(W)
X = SX*C - SY*S: TA = XA: XA = TA*C - YA*S
Y = SX*S + SY*C: YA = TA*S + YA*C
z = Y*SI: TA = ZA: ZA = YA*SI+TA*CI: ANTZ = ZA
Y = Y*CI: YA = YA*CI-TA*SI: ANTY = YA
ANTX = XA
RAAN = RA + QD*T*KDP
GHAA = GHAE + WE*T
Q = RAAN - GHAA
C = COS(Q): S = SIN(Q)
SX = X*C - Y*S: TA = XA: XA = TA*C - YA*S
SY = X*S + Y*C: YA = TA*S + YA*C
SZ = z
C = COS(RAAN): S = SIN(RAAN)
SATX = X*C - Y*S: TA = ANTX: ANTX = TA*C - ANTY*S
SATY = X*S + Y*C: ANTY = TA*S + ANTY*C
SATZ = z
NMX = S*SI: NMY = -C*SI: NMZ = CI
RETURN
SunVec:
MAS = MASE + RAD*(MASD*T)
TAS = MRSE + WW*T + EQC1*SIN(MAS) + EQC2*SIN(2*MAS) + EQC3*SIN(3*MAS)
C = COS(TAS): S = SIN(TAS)
SUNX = C: SUNY = S*CNS: SUNZ = S*SNS
CSA = ANTX*SUNX + ANTY*SUNY + ANTZ*SUNZ
ILL = SQR(1-CSA*CSA)
SATX = SATX/RGC: SATY = SATY/RGC: SATZ = SATZ/RGC
CUA = -(SATX*SUNX + SATY*SUNY + SATZ*SUNZ)
UMD = RGC*SQR(1-CUA*CUA)/RE
SEL = (SUNX*NMX + SUNY*NMY + SUNZ*NMZ)
SEL = ATN(SEL/SQR(-SEL*SEL+1))
IF CUA >= 0 THEN ECL$ = " +" ELSE ECL$ = " -"
IF UMD <= 1 AND CUA >= 0 THEN ECL$ = " ECL"
RETURN
RangeVec:
RX = SX - OX: RY = SY - OY: RZ = SZ - OZ
R = SQR(RX*RX + RY*RY + RZ*RZ)
RX = RX/R: RY = RY/R: RZ = RZ/R
U = RX*UX + RY*UY + RZ*UZ
E = RX*EX + RY*EY + RZ*EZ
N = RX*NX + RY*NY + RZ*NZ
AZ = DEG*(ATN(E/N))
IF N < 0 THEN AZ = AZ + 180
IF AZ < 0 THEN AZ = AZ + 360
EL = DEG*(ATN(U/SQR(-U*U+1)))
srr = SQR(SX*SX+SY*SY)
ssrr = SQR(SX*SX+SY*SY+SZ*SZ)
szrr = SZ/ssrr: syr = SY/srr
satLat1 = DEG*(ATN(szrr/SQR(-szrr*szrr+1)))
satLong1 = DEG*(ATN(syr/SQR(-syr*syr+1)))
SQ = -(XA*RX + YA*RY + ZA*RZ)
SQ = DEG*(-ATN(SQ/SQR(-SQ*SQ+1))+1.5708)
RETURN
TodayDate:
day = VAL(MID$(DATE$,4,2))
month = VAL(LEFT$(DATE$,2))
YR = VAL(RIGHT$(DATE$,4))
DY = day + days&(month): IF month > 2 THEN DY = DY + (INT(YR/4)-INT((YR-1)/4))
RETURN
TimeNow:
hour = VAL(LEFT$(TIME$,2))
minutes = VAL(MID$(TIME$,4,2))+(VAL(RIGHT$(TIME$,2))/60)
RETURN
ScreenSetup:
MENU
ON MENU GOSUB CheckMenu: MENU ON
MENU 1,0,1,"Project "
MENU 1,1,2," Map Display "
MENU 1,2,1," "
MENU 1,3,1," Serial Echo "
MENU 1,4,1," Quit "
MENU 2,0,1," "
MENU 3,0,1," "
MENU 4,0,1," "
MENU 5,0,1," "
MENU 6,0,1," "
RETURN
Constants:
days&(0)=0:days&(1)=0:days&(2)=31:days&(3)=59:days&(4)=90:days&(5)=120:days&(6)=151
days&(7)=181:days&(8)=212:days&(9)=243:days&(10)=273:days&(11)=304:days&(12)=334
LA = 51.268333# ' Latitude of QTH, + north, - south
LO = -.563333 ' Longitude of QTH, + deg east, - deg west
HT = 35 ' Height of QTH above mean sea level
pi = 3.141592654#
DEG = 180/pi
RAD = 1/DEG
DEF FNRN(X) = INT(X+.5)
LA = RAD*LA
LO = RAD*LO
HT = HT/1000
CL = COS(LA)
SL = SIN(LA)
CO = COS(LO)
SO = SIN(LO)
RE = 6378.14
FL = 1/298.256
RP = RE*(1-FL)
XX = RE*RE
ZZ = RP*RP
D = SQR(XX*CL*CL + ZZ*SL*SL)
RX = XX/D + HT
RZ = ZZ/D + HT
UX = CL*CO: EX = -SO: NX = -SL*CO
UY = CL*SO: EY = CO: NY = -SL*SO
UZ = SL: EZ = 0: NZ = CL
OX = RX*UX: OY = RX*UY: OZ = RZ*UZ
YG = 1988: GO = 98.8897
MASO = 356.1611: MASD = .9856002671#
INS = RAD*23.4408: CNS = COS(INS): SNS = SIN(INS)
EQC1 = .03342715297#: EQC2 = .00034917#: EQC3 = .00000506#
YM = 365.25
YT = 365.2421938#
DEF FNDO(Y) = INT((Y-1)*YM)
WW = 2*pi/YT
WE = 2*pi + WW
J2 = .00108263#
RETURN
Ephemeris:
SatName$(1)="OSCAR 10s ": SatName$(2)="OSCAR 11 ": SatName$(3)="OSCAR 13s "
C1(1)=1989: C1(2)=1990: C1(3)=1989
C2(1)=330.318#: C2(2)=86.14190031#: C2(3)=324.328282#
C3(1)=25.9: C3(2)=97.963: C3(3)=57.12
C4(1)=232: C4(2)=141.366: C4(3)=181.5
C5(1)=.6: C5(2)=.0012026: C5(3)=.6831
C6(1)=96: C6(2)=141.7015: C6(3)=215.48
C7(1)=331: C7(2)=218.5388: C7(3)=0
C8(1)=2.0588#: C8(2)=14.65066797#: C8(3)=2.097
C9(1)=0: C9(2)=.00002602#: C9(3)=0
C10(1)=4855: C10(2)=32395: C10(3)=1099
C11(1)=0: C11(2)=0: C11(3)=0
C12(1)=0: C12(2)=0: C12(3)=3.6
C13(1)=180: C13(2)=180: C13(3)=179.4
SatName$(4)="OSCAR 14 ": SatName$(5)="OSCAR 15 ": SatName$(6)="OSCAR 16 "
C1(4)=1990: C1(5)=1990: C1(6)=1990
C2(4)=22.0781597#: C2(5)=22.0781597#: C2(6)=22.0781597#
C3(4)=98.738: C3(5)=98.738: C3(6)=98.738
C4(4)=97.9558: C4(5)=97.9558: C4(6)=97.9558
C5(4)=.00133: C5(5)=.00133: C5(6)=.00133
C6(4)=114.674: C6(5)=114.674: C6(6)=114.674
C7(4)=281.82: C7(5)=281.82: C7(6)=281.82
C8(4)=14.221152#: C8(5)=14.221152#: C8(6)=14.221152#
C9(4)=-.000005#: C9(5)=.000005: C9(6)=.000005#
C10(4)=0: C10(5)=0: C10(6)=0
C11(4)=0: C11(5)=0: C11(6)=0
C12(4)=0: C12(5)=0: C12(6)=0
C13(4)=180: C13(5)=180: C13(6)=180
SatName$(7)="OSCAR 17 ": SatName$(8)="OSCAR 18 ": SatName$(9)="OSCAR 19 "
C1(7)=1990: C1(8)=1990: C1(9)=1990
C2(7)=22.0781597#: C2(8)=22.0781597#: C2(9)=22.0781597#
C3(7)=98.738: C3(8)=98.738: C3(9)=98.738
C4(7)=97.9558: C4(8)=97.9558: C4(9)=97.9558
C5(7)=.00133: C5(8)=.00133: C5(9)=.00133
C6(7)=114.674: C6(8)=114.674: C6(9)=114.674
C7(7)=281.82: C7(8)=281.82: C7(9)=281.82
C8(7)=14.221152#: C8(8)=14.221152#: C8(9)=14.221152#
C9(7)=-.000005#: C9(8)=.000005: C9(9)=.000005#
C10(7)=0: C10(8)=0: C10(9)=0
C11(7)=0: C11(8)=0: C11(9)=0
C12(7)=0: C12(8)=0: C12(9)=0
C13(7)=180: C13(8)=180: C13(9)=180
SatName$(10)="OSCAR 20 "
C1(10)=1990
C2(10)=85.20385752#
C3(10)=99.052
C4(10)=147.3503
C5(10)=.0540825
C6(10)=236.3713
C7(10)=118.4676
C8(10)=12.83121017#
C9(10)=9.599999999999D-07
C10(10)=610
C11(10)=0:
C12(10)=0:
C13(10)=180:
RETURN